<span id='shareObjectsStorage_panel' style='position:absolute'></span>
<img src="plugins/cron/cron.php?<{$stateString}>" width="1" height="1" border="none" />

<{if $mini_cart}>

<div id='mini-shop-cart' class='mini-shop-cart division boxGray' style='position:absolute;z-Index:65535;width:370px;visibility:hidden;top:-3000px;border:7px solid #5D6F8B;font-family:Georgia,"Times New Roman",Times,serif!important'>
   <table border="0" cellpadding="0" cellspacing="0" class='liststyle' style='background:#fff'>
      <thead>
      <tr>
         <th width='95%' style='text-align:left' class='title'><{img  src="statics/bundle/arrow-down.gif"}>我的购物车</th>
         <th>&nbsp;&nbsp;<span onmouseover="this.style.color='#cc0000'" onmouseout="this.style.color='#666666'" class='close' style="font-size:14px; font-weight:bold; font-family:Verdana, Arial, Helvetica, sans-serif; color:#666666; cursor:pointer;">X</span>&nbsp;&nbsp;</th>
      </tr>
      </thead>
      <tbody>
         <tr>
           <td colspan='2' style='text-align:left;'>
               <div class='cart-view' style='overflow:hidden;overflow-y:auto;width:100%;height:200px;'>
                      <b class='note'>正在加入购物车 ...</b>
               </div>
           </td>
         </tr>
      </tbody>
   </table>
   <table class='liststyle'>
   <tr>
      <td colspan=2 style='text-align:right;'>
         <div class='total'>商品总金额: <span class='price1'></span></div>
      </td>
   </tr>
    <tr>
        <td width='50%' style='text-align:left;'> &nbsp; <span class='close' style='cursor:pointer;color:#000;font-weight:bold;'>«&nbsp;继续购物</span></td>
        <td style='text-align:right;'>
        
      <!--  <span style='cursor:pointer;'><a href='<{link ctl=cart act=index}>' style='text-decoration:none;font-weight:bold;'>查看购物车&nbsp;»</a></span> &nbsp; -->
        
        <a href='<{link ctl=cart act=index}>' style='text-decoration:none;font-weight:bold;'><img border="none" alt="进入购物车" src="statics/btn-gocart.gif"/></a>&nbsp;
        
        </td>
     </tr>
   </table>
</div>

<script>
window.addEvent('domready',function(){
    /*
          #Mini shop cart
         @autohor: litie[aita]shopex.cn
         @MORE :  code.google.com/p/shopex
    */
     var mCart=$('mini-shop-cart').inject(document.body);
     var mCart_view=mCart.getElement('.cart-view');
     var mCart_close=mCart.getElements('.close');
     var up_cno=$$('.cart-number');
     
     var _win=window.ie?$(document.body):window;
     

     
     var mCart_modal=new Element('div',{
         styles:{
             'background':'#999',
             'position':'absolute',
             'display':'none',
             /*'height':5000,*/
             'width':'100%',
             'zIndex':65534,
             'top':0,
             'left':0,
             'opacity':.5
         }
     }).inject(document.body);
     
     if(window.ie6){
        
        new Element('iframe',{src:'javascript:void(0)',styles:{
             'position':'absolute',
             'zIndex':-1,
             'border':'none',
             'width':'100%',
             /*'height':5000,*/
             'top':0,
             'left':0,
             'filter':'alpha(opacity=0)'
        }}).inject(mCart_modal);
     
     }
     
     var mCartAmong=function(){
          mCart.amongTo(window);
     };
     
     mCart.addEvents({
           'SHOW':function(){
                mCart_modal.show();
                this.amongTo(window).setStyle('visibility','visible');
                _win.addEvent('resize',mCartAmong);
                
           },
           'HIDE':function(){
                mCart_modal.hide();
               this.setStyle('visibility','hidden');
                _win.removeEvent('resize',mCartAmong);
                
           },
           'LOADCART':function(){
              var params=Array.flatten(arguments).link({
                  'remoteURL':String.type,
                  'options':Object.type
              });
              var NOTE={
                 add:"<div class='note'>正在加入购物车...</div>",
                 load:"<div class='note'>正在读取购物车信息...</div>"
              };
              var opts=params=$extend({
                 url:params.remoteURL,
                 method:'post',
                 onRequest:function(){
                     mCart_view.set('html',NOTE.add);
                 }
              },params.options||{});
              
              if(!params.url)return false;
              
              this.fireEvent('SHOW');
             
              
              new Request(opts).send().chain(function(){
                  
                  new Request({
                       onRequest:function(){
                          mCart_view.set('html',NOTE.load);
                       },
                       onSuccess:function(re){
                         var _total='';
                         var _re=re.replace(/<div class=\'cart-goods-total\'>[\s\S]*?<span[^>]*>([\s\S]*?)<\/span>[\s\S]*?<\/div>/i,function($0,$1){
                             
                              _total=$1;
                              
                              return "";
                         });
                 
                         mCart_view.set('html',_re);
                         mCart.getElement('.price1').set('html',_total);
                         
                         if(up_cno.length){
                            up_cno.set('text',Cookie.get('S[CART_COUNT]')?Cookie.get('S[CART_COUNT]'):0);
                         }
                       }
                  }).get('<{link ctl=cart act=view}>');
              
              });
              
             
              
           }
     });
     
     
     mCart_close.addEvent('click',function(){
          
          mCart.fireEvent('HIDE');
     
     });


     _win.focus();
     _win.addEvent('keydown',function(e){
        if (e.key == 'esc') {
            e.stop();
             mCart.fireEvent('HIDE');
         }
     });
   

   if(formtocart=$E('form[target=_dialog_minicart]')){
       formtocart.addEvent('submit',function(e){
           
           e.stop();
           mCart.fireEvent('LOADCART',[{
               url:this.action,
               method:this.method,
               data:this       
           }]);
       
       });
   };
   /*for  goods which has specs*/
   if(btnbuy=$E('#goods-viewer form[target=_dialog_minicart] .btn-buy')){
      
      btnbuy.removeEvents('click').addEvent('click',function(e){
          e.stop();
          if(this.retrieve('tip:text'))return false;
          this.blur();
          this.form.fireEvent('submit',e);
      
      });
   
   };
   
   if(linktocart=$$('a[target=_dialog_minicart]')){
       if(linktocart.length){
            linktocart.addEvent('click',function(e){
            
                 e.stop();
             
                 mCart.fireEvent('LOADCART',this.href);
            });
         
       }
   
   };
   var _winSize=window.getSize().size;
   new Drag(mCart,{handle:mCart.getElement('.title').setStyle('cursor','move'),limit:{x:[0,_winSize.x-400],y:[0,5000]}});
   
});
 
</script>
<{/if}>